package com.dayatang.exam.domain;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

/**
 * 判断�?
 * 
 * @author yang
 * 
 */
@Entity
@DiscriminatorValue("J")
public class JudgementQuestion extends Question implements ObjectiveQuestion {
	
	private static final long serialVersionUID = -2115703999982112311L;
	
	public static final String TRUE = "T";
	
	public static final String FALSE = "F";

	@Override
	public String getTypeName() {
		return Question.TYPE_JUDGEMENT;
	}
	
	public Map<String, String> getJudgementMap() {
		Map<String, String> result = new HashMap<String, String>();
		result.put("T", "对");
		result.put("F", "错");
		return result;
	}

	public boolean isCorrect(String answer) {
		return getSolution().equals(answer);
	}

	
	public static JudgementQuestion get(Long id) {
		return getRepository().get(JudgementQuestion.class, id);
	}
}
